import  {url}  from "./index"
import axios  from "axios"


//查询
export const render=async (params)=>{
    let res=await axios({
        methods:"get",
        url:url+"/users",
        params
    })
    return res.data
}

//删除
export  const dele=async(id)=>{
    let res=await axios({
        method:"delete",
        url:url+"/users/"+id
    })
    return  res
}

//根据id查找
export  const  findById=async(id)=>{
    let res=await axios({
        method:"get",
        url:url+"/users/"+id
    })
   return res.data
}

//增加
export  const  insert=async(data)=>{
    let res=await axios({
        method:"post",
        url:url+"/users",
        data
    })
    return res.data
}

//修改
export const putUser=async(data)=>{
    let res=await axios({
        method:"put",
        url:url+"/users/"+data._id,
        data
    })
    return res.data
}